package com.java.eight.stream;

import java.util.Random;
import java.util.function.Supplier;

/**
 * @version v1.0
 * @description: 自定义流时的supplier
 * @author: xiaoliang.liu
 * @date: 2018/7/8 23:02
 */
public class CustomStreamSupplier implements Supplier<CustomStreamBean> {

    private int index = 0;

    private Random random = new Random(System.currentTimeMillis());

    @Override
    public CustomStreamBean get() {
        index = random.nextInt(100);
        return new CustomStreamBean(index, "name->" + index);
    }
}
